package com.Register.controller.admin;

import com.Register.dto.ESDTO;
import com.Register.result.Result;
import com.Register.service.WxUserService;
import com.Register.vo.ActivityResponseVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController("webEsController")
@Slf4j
@RequestMapping("/web/admin/activity/es")
@Tag(name="用户端搜索引擎接口")
public class EsActivityController {
    @Resource
    private WxUserService wxUserService;

//    @GetMapping("/queryAll")
//    @Operation(summary = "es引擎查询所有的志愿活动")
//    public Result<ActivityResponseVO> queryAllActivity() throws IOException{
//        return Result.success(wxUserService.queryAllActivity());
//    }

    @GetMapping("/match")
    @Operation(summary = "es引擎根据活动名查询志愿活动")
    public Result<ActivityResponseVO> queryMatchActivity(@ParameterObject ESDTO esdto) throws IOException {
        return Result.success(wxUserService.queryMatchActivity(esdto));
    }

    @GetMapping("/match/highlight")
    @Operation(summary = "es引擎根据活动名查询志愿活动返回高亮结果")
    public Result<ActivityResponseVO> queryMatchActivityWithHighLight(@ParameterObject ESDTO esdto) throws IOException {
        return Result.success(wxUserService.queryMathActivityWithHighlight(esdto));
    }
}
